<%-- 
    Document   : AdminQL
    Created on : Nov 22, 2012, 10:14:10 PM
    Author     : SOny
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" import="java.sql.*"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>
            Admin manager
        </title>
        <META http-equiv=Content-Type
              content="text/html; charset=UTF-8">
        <link href="css/index_style.css" rel="stylesheet" type="text/css" />

    </head>
    <body>
        <%
            if (session.getValue("username") == null) {
                response.sendRedirect("admin.jsp");
            }
        %>
        <div id="baby_wrapper_outter">

            <div id="baby_wrapper_inner">
                <jsp:include page="headerAdmin.jsp"/>
                <div id="baby_content_wrapper">
                    <jsp:include page="menuLeftAdmin.jsp"/>

                    <form action="Add" method="post">
                        <input type="submit" value="Addnew" name="bt"/>
                        <input type="text" value="ID" name="id" readonly/>
                        <input type="text" value="NAME" name="name"/>
                        <input type="text" value="PASS" name="pass"/>

                    </form>
                    
                    <div id="baby_content">


                        <div class="content_section">

                            <c:if test="${requestScope.listad==null}">
                                <c:redirect url="getAdmin"/>
                            </c:if>

                            <table class="table" align="center" >
                                <tr>
                                    <th>ID</th>             <th>UserName</th>           <th>PassWord</th>              <th>Update</th>     <th>Delete</th>
                                </tr>

                                <c:forEach items="${requestScope.listad}" var="ad">  
                                    <c:if test="${ad.id!=param.idsua}">
                                        <tr>                                          
                                            <td width="150" height="80" align="center">
                                                ${ad.id}                                            
                                            </td>
                                            <td  width="150" height="80" align="center" >
                                                ${ad.name}        
                                            </td>
                                            <td  width="150" height="80" align="center" >
                                                ${ad.pass}         
                                            </td>

                                            <td  width="150" height="80" align="center">
                                                <a href="getAdmin?idsua=${ad.id}" style=" color: #660033">Update</a>        
                                            </td>

                                            <td  width="150" height="80" align="center">
                                                <a href="xoa?id=${ad.id}" style=" color: #660033"> Delete </a>        
                                            </td>

                                        </tr>
                                    </c:if>

                                    <c:if  test="${ad.id==param.idsua}">
                                        <tr>
                                        <form action="EditAdmin" method="post">
                                            <td><input name="idsua" value="${ad.id}" readonly /></td>
                                            <td><input name="name" value="${ad.name}" /></td>
                                            <td><input name="pass" value="${ad.pass}" /></td>

                                            <td><a href="xoa?id=${ad.id}" style=" color: #660033">Delete</a></td>
                                            <td><input type="submit" name="btEdit" value="Edit"/></td>
                                        </form>
                                        </tr>
                                    </c:if>
                                </c:forEach>
                            </table>
                        </div>
                    </div>

                    <div class="cleaner"></div>

                </div> <!-- end of baby_content_wrapper -->

            </div> <!-- end of baby_wrapper_inner -->
        </div> <!-- end of baby_wrapper_outter -->
        <jsp:include page="footerAdmin.jsp"/>
    </body>
</html>


